package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.AdminPosition;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AdminPositionDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "用户id")
    private Integer adminId;

    @ApiModelProperty(value = "岗位id")
    private Integer positionId;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;


    public AdminPositionDTO() {}

    public AdminPositionDTO(AdminPosition entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static AdminPositionDTO convert(AdminPosition entity) {
        return new AdminPositionDTO(entity);
    }

    public static List<AdminPositionDTO> convertList(List<AdminPosition> list) {
        List<AdminPositionDTO> resultList = new ArrayList<>();
        for (AdminPosition entity : list) {
            resultList.add(new AdminPositionDTO(entity));
        }
        return resultList;
    }}
